import request from "@/utils/request"; // axios请求

import type { ISkuList, ISku } from "./model"; // 数据类型

enum API {
  SKULIST = "/admin/product/list/", // 获取SKU列表的接口
  ONSALE = "/admin/product/onSale/", // 上线
  CANCELSALE = "/admin/product/cancelSale/", // 下线
  SKUDATA = "/admin/product/getSkuById/", // sku详情
  DELETESKU = "/admin/product/deleteSku/", // 删除sku
}

// 获取SKU数据列表
export const reqSkuList = (page: number, limit: number) =>
  request.get<any, ISkuList>(API.SKULIST + `${page}/${limit}`);

// 请求上线
export const reqOnSale = (skuId: number | undefined) =>
  request.get<any, any>(API.ONSALE + skuId);

// 请求下线
export const reqCancelSale = (skuId: number | undefined) =>
  request.get<any, any>(API.CANCELSALE + skuId);

//  请求sku详情
export const reqSkuData = (skuId: number | undefined) =>
  request.get<any, ISku>(API.SKUDATA + skuId);

// 删除sku亲求
export const reqDeleteSku = (skuId: number | undefined) =>
  request.delete<any, any>(API.DELETESKU + skuId);
